package cn.z2huo.knowledge.streamapi.distinct;

import lombok.*;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 *
 * @author z2huo
 */
class DistinctTest {

    @Accessors(chain = true)
    @Getter
    @Setter
    @RequiredArgsConstructor
//    @NoArgsConstructor
    @AllArgsConstructor
    @EqualsAndHashCode(of = {"id"})
//    @EqualsAndHashCode
    @ToString
    static class Person {

        private Long id;

        private String name;

        private Integer age;

    }

    public static void main(String[] args) {
        List<String> list = List.of("12", "13", "14", "12");
        System.out.println(list.stream().distinct().toList());
        System.out.println();

        List<Person> personList = List.of(
                new Person(1L, "li lei", 18),
                new Person(2L, "zhang ming", 19),
                new Person(3L, "han meimei", 17),
                new Person(3L, "han han", 20)
        );
        personList.stream().distinct().forEach(System.out::println);
    }

}
